export default class UIButton extends Laya.Sprite{
    constructor(){
        super();
    }

    onAwake(){
        this.pivotY = this.height/2;
        this.pivotX = this.width/2;
        this.on(Laya.Event.MOUSE_DOWN,this,this.scaleSmall);
        this.on(Laya.Event.MOUSE_UP,this,this.mouseUp);
        this.on(Laya.Event.MOUSE_OUT,this,this.scaleNoraml);
    }

    scaleSmall(){
        this.scaleX = this.scaleY = 0.8;
    }
    
    mouseUp(){
        this.scaleNoraml();
        let fire = this.parent.event("mm_click",this.name);
        console.log("fired:"+fire);
    }

    scaleNoraml(){
        this.scaleX = this.scaleY = 1;
    }
}